
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@	page import="java.util.ArrayList"%>
<%@	page import="kau.dao.*"%>
<%@	page import="kau.vo.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>CustList</title>


<script type="text/javascript">
	function showList() {

		var selectValue = document.getElementById("selectedCustLevel").value;

		
		location.replace('getCustomerList.cust?selectedCustLevel='
				+ selectValue);
	}

	function edit_yes(custId) {
		//alert(custId);
		var theForm = document.form;
		theForm.method = "post";
		theForm.action = "getCustomer.cust?selectedId=" + custId;

		theForm.submit();
	}

	function edit_no(custId, password) {
		if (confirm('삭제하시겠습니까?')) {
			var theForm = document.form;
			theForm.method = "post";
			theForm.action = "delete.cust?custId=" + custId + "&password="
					+ password;

			theForm.submit();
			return true;
		} else {
			return false;
		}

	}
</script>


<style type="text/css">
<!--
@import url("css/style.css");
-->
</style>

<style type="text/css">
#info {
	font-family: 맑은 고딕, dotum, sans-serif, bold;
	font-size: 13px
}
</style>

</head>

<body>
	<form name='form' id="info">

		<br>
		<table align="left" style="margin-left: 20px">
			<tr>

				<td width="60" height="50"><img
					src="/nems/admin/images/cust.png" width="40"/></td>

				<td>
					<h4
						style="font-weight: bold; color: #005700; text-align: left; font-size: 20px;">회원관리</h4>
				</td>
			</tr>
		</table>


		<br> <br>


		<p align="right" style="margin-right: 25px">
			<strong>카테고리 선택 : </strong> <select name="selectedCustLevel"
				id="selectedCustLevel" onchange="showList()">



				<%
					ArrayList<Customer> custList = (ArrayList) request
							.getAttribute("custList");
				%>


				<option value="0">전체보기</option>
				<option value="1">1.관리자</option>
				<option value="2">2.강사</option>
				<option value="3">3.학생</option>
				<option value="4">4.권한없음</option>
			</select>
		<center>
			<table id="newspaper-a" summary="2007 Major IT Companies' Profit"
				style="width: 700px;">
				<tr align="center">
					<th scope="col">No.</th>
					<th scope="col">ID</th>
					<th scope="col">이름</th>
					<th scope="col">가입 일자</th>
					<th scope="col">등급</th>
					<th scope="col">관리</th>
				</tr>
				<%
					int no = 0;
					for (int i = 0; i < custList.size(); i++) {

						if (!custList.get(i).getCustId()
								.equals(session.getAttribute("custId"))) {
							no++;
						} else {
							continue;
						}
				%>

				<tr align="center">

					<td><%=no%></td>
					<td><%=custList.get(i).getCustId()%></td>
					<td><%=custList.get(i).getCustName()%></td>
					<td><%=custList.get(i).getJoinDate()%></td>
					<td><%=custList.get(i).getCustLevel()%></td>
					<td>
						<button class="positive" style="width: 70px;"
							onclick="edit_yes('<%=custList.get(i).getCustId()%>')">
							<img src="admin/images/Edit_Yes.png"
								style="width: 20px; height: 20px" />수정
						</button> &nbsp;
						<button class="negative" style="width: 70px;"
							onclick="return edit_no('<%=custList.get(i).getCustId()%>','<%=custList.get(i).getPassword()%>')">
							<img src="admin/images/Edit_No.png"
								style="width: 20px; height: 20px" />삭제
						</button>

					</td>
				</tr>
				<%
					}
				%>
			</table>
		</center>
		<center>
			<a
				href="javascript:location.replace('index.jsp?contentMenu=admin/menuPage.jsp&content=admin/mainPage.jsp')"
				class="css_btn_class">이전화면으로</a>
		</center>
	</form>

</body>
</html>
